package dao.impl;

import dao.BaseDao;
import dao.UserDao;
import entity.JavaBean;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class UserDaoImpl implements UserDao {
    @Override
    public List<JavaBean> findUser(String sname, String semail) throws SQLException {
        String sql="SELECT * FROM studentInfo WHERE sname=? AND semail=?";
        BaseDao dao = new BaseDao();
        ResultSet resultSet = dao.ExecuteQuery(sql, sname, semail);
        JavaBean user =null;
        ArrayList<JavaBean> list = new ArrayList<>();
        if (resultSet.next()){
            user=new JavaBean();
           user.setSid(resultSet.getInt("sid"));
           user.setSname(sname);
           user.setSemail(semail);
            list.add(user);
        }
        return list;
    }
}
